﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CourseSystem.Common.Helpers;

namespace CourseSystem.Web.Controllers
{
    public class AjaxController : Controller
    {
        protected new JsonResult Json(object data)
        {
            return Json(data, "text/html", JsonRequestBehavior.AllowGet);
        }

        public ActionResult GetCollege()
        {
            return Json(StudentHelper.GetCollege(true));
        }

        public ActionResult GetSubject(int id)
        {
            return Json(StudentHelper.GetSubject(id, true));
        }

        public ActionResult GetClass()
        {
            return Json(StudentHelper.GetClass(true));
        }

        public ActionResult GetGradeYear()
        {
            return Json(StudentHelper.GetGradeYear(true));
        }

        public ActionResult GetTeacher(int? id)
        {
            return Json(TeacherHelper.GetTeacher(!id.HasValue));
        }
    }
}
